<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:lzc="http://schemas.icitadel.com/Lazarus/Compiled.xsd" version="1.0">

	<xsl:output method="text"/>

	<xsl:include href="../../common.xsl" />
	<xsl:include href="../../convert.xsl" />

   <xsl:template match="lzc:project">/*
* Copyright 2012 Google Inc. All Rights Reserved.
*
* __author__ = joemu@google.com (Joe Allan Muharsky)
*
* Drops the indexes from the <xsl:value-of select="@name" /> database.
*
*/

# Drop Indexes
<xsl:for-each select=".//lzc:table/lzc:fields/lzc:field[ lzc:indexes/lzc:index/@type = $INDEXTYPE_FOREIGN ]">
  <xsl:variable name="TABLE_NAME">
  	<xsl:value-of select="ancestor::lzc:table/@alias" />
  </xsl:variable>
  <xsl:variable name="INDEX_NAME" select="lzc:indexes/lzc:index[ ( @name ) and not( @type = $INDEXTYPE_PRIMARY ) and not( @type = $INDEXTYPE_CLUSTERED ) ]/@name" />
  <xsl:text>DROP INDEX </xsl:text><xsl:value-of select="$INDEX_NAME" />;</xsl:for-each>
<xsl:text>

</xsl:text>

   </xsl:template>

</xsl:stylesheet>
